package com.wolf.cx330.view.view

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View
import com.wolf.cx330.base.dp

/**
 * 动画进行程度手动计算
 *
 * Text 动态变化
 */
class TextAnimView(context: Context, attributeSet: AttributeSet) : View(context, attributeSet) {
    private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
        textAlign = Paint.Align.CENTER
        style = Paint.Style.FILL
        textSize = 32.dp()
        color = Color.WHITE
    }
    var textVal = "北京市"
        set(value) {
            field = value
            invalidate()
        }

    override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)
        canvas.drawText(textVal, width / 2F, height / 2F, paint)

    }

}